﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tetris.Game.Properties;

namespace Tetris.Game.Common.TetrisCenter
{
    public static class SoundFactory
    {
        /// <summary>
        /// 到底
        /// </summary>
        static Stream _through = Resources.y2208;
        static Stream _move = Resources.y2265;
        static Stream _fight = Resources.y2210;
        static Stream _gameOver = Resources._5427;
        static Stream _gameStart = Resources._5480;
        static SoundManager _soundManager;
        static SoundFactory()
        {
            _soundManager = SoundManager.Instance;
        }
        public static void PlaySound(this SoundType soundType)
        {
            switch (soundType)
            {
                case SoundType.Through:
                    _soundManager.PlaySound(_through);
                    break;
                case SoundType.Move:
                    _soundManager.PlaySound(_move);
                    break;
                case SoundType.Fight:
                    _soundManager.PlaySound(_fight);
                    break;
                case SoundType.GameOver:
                    _soundManager.PlaySound(_gameOver);
                    break;
                case SoundType.GameStart:
                    _soundManager.PlaySound(_gameStart);
                    break;
            }
        }

        public static void Dispose()
        {
            _through.Dispose();
            _move.Dispose();
            _fight.Dispose();
            _gameOver.Dispose();
            _gameStart.Dispose();
            _soundManager.Dispose();
        }
    }
    public enum SoundType
    {
        /// <summary>
        /// 到底
        /// </summary>
        Through,
        /// <summary>
        /// 移动
        /// </summary>
        Move,
        /// <summary>
        /// 加油
        /// </summary>
        Fight,
        /// <summary>
        /// 游戏结束
        /// </summary>
        GameOver,
        /// <summary>
        /// 游戏开始
        /// </summary>
        GameStart,
    }
}
